

using Mengsk.ProxyDelivery.Domain;
using NHibernate;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mengsk.ProxyDelivery.Dao.HibernateImpl
{
    public class OperatorDao : HibernateDao<Operator>, IOperatorDao
    {
        public Operator GetByNumber(string number)
        {
            using (ISession session = this.OpenSession())
            {
                IQuery hQuery = session.CreateQuery("from Operator where Number=?").SetString(0, number);
                return hQuery.UniqueResult<Operator>();
            }
        }

        public Operator Get(string number, string password)
        {
            using (ISession session = this.OpenSession())
            {
                IQuery hQuery = session.CreateQuery("from Operator where Number=? and Password=?").SetString(0, number).SetString(1, password);
                return hQuery.UniqueResult<Operator>();
            }
        }
    }
}
